package logic

import (
	"cart_srv/model/redis"
	"context"

	"cart_srv/cart"
	"cart_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type CartYNLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCartYNLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CartYNLogic {
	return &CartYNLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *CartYNLogic) CartYN(in *cart.CartYNRequest) (*cart.CartYNResponse, error) {
	// todo: add your logic here and delete this line
	if !redis.CartYN(in.UserId) {
		return &cart.CartYNResponse{Success: false}, nil
	} else {
		return &cart.CartYNResponse{Success: true}, nil
	}

}
